﻿using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Sysgeprava.Entities;


namespace Sysgeprava.Repository.Mapping
{
    public class HIST_ETAPAMap:EntityTypeConfiguration<HIST_ETAPA>
    {
        public HIST_ETAPAMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Observacion)
                .IsRequired()
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("HIST_ETAPA");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.IdEtapa).HasColumnName("IdEtapa");
            this.Property(t => t.IdBovino).HasColumnName("IdBovino");
            this.Property(t => t.Fecha).HasColumnName("Fecha");
            this.Property(t => t.Observacion).HasColumnName("Observacion");

            // Relationships
            this.HasRequired(t => t.ETAPA)
                .WithMany(t => t.HIST_ETAPA)
                .HasForeignKey(d => d.IdEtapa);
            this.HasRequired(t => t.BOVINO)
                .WithMany(t => t.HIST_ETAPA)
                .HasForeignKey(d => d.IdBovino);
        }
    }
}
